import openai

api_key = ""# openai key
openai.api_key = api_key


def askChatGPT(messages):
    mes = [
        {
            "role": "system",
            "content": ""
        },
        {
            "role": "user",
            "content": messages
        },
    ]
    MODEL = "gpt-3.5-turbo"
    response = openai.ChatCompletion.create(model=MODEL,
                                            messages=mes,
                                            temperature=0)
    return (response['choices'][0]['message']['content'])


# messages = [
#     {
#         "role": "system",
#         "content": ""
#     },
#     {
#         "role": "user",
#         "content": "怎样在中国大陆申请visa卡"
#     },
# ]
# askChatGPT(messages)
